#!/bin/bash

echo "正在创建密钥对"

ssh-keygen -f /root/.ssh/id_rsa -N '' &>> /dev/null

echo "正在分发密钥对"

for ip in $(cat /root/bash_set/passwd.txt)

do
 sshpass -p "123" ssh-copy-id $ip -o StrictHostKeyChecking=no &>> /dev/null

 ssh $ip 'hostname'

done
